import React from 'react';
import TweenOne from 'rc-tween-one';
import style from './css/TransitionAnimationComponent.css';

class TransitionAnimationComponent extends React.Component {
	
	render() {
		let className;
		let cover = this.props.cover;
		switch (cover){
			case 'auto':
				className = undefined;
				break;
			default:
				className = style.container;
				break;
		}
		return (
			<TweenOne 
			className={className} 
			key={this.props.currentKey || this.props.location && this.props.location.pathname || 'transitionAnimationComponentKey'} 
			style={{
				opacity: 0
			}} 
			animation={{
				opacity: 1,
				duration: 350
			}}>
        		{this.props.children}
        	</TweenOne>
		);
	}
	
}

export default TransitionAnimationComponent;